Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal source As Long, ByVal length As Long)
' Driver type for enumeration of D3D driver...
Public Type tD3DDriver
DESC As String ' Driver description
NAME As String ' Driver name
GUID As Byte ' Unique interface ID for accessing driver
GUID1 As Byte ' ...
GUID2 As Byte ' ...
GUID3 As Byte ' ...
GUID4 As Byte ' ...
GUID5 As Byte ' ...
GUID6 As Byte ' ...
GUID7 As Byte ' ...
GUID8 As Byte ' ...
GUID9 As Byte ' ...
GUID10 As Byte ' ...
GUID11 As Byte ' ...
GUID12 As Byte ' ...
GUID13 As Byte ' ...
GUID14 As Byte ' ...
GUID15 As Byte ' ...
DEVDESC As D3DDEVICEDESC ' Device description for use by D3DRM
HDW As Boolean ' Device is hardware
EMU As Boolean ' Device is software-emulated
RGB As Boolean ' Device has rgb caps
MONO As Boolean ' Device has mono ramp caps
End Type
' Driver Array for driver detection ...
Public G_dD3DDriver() As tD3DDriver ' Drivers for use with Direct3DRM
Public G_nD3DDriverCount As Integer ' Count of drivers
Global G_dD3DSelectedDriver As tD3DDriver ' Driver to use
' ENUMDEVICECALLBACK: Enumerates Device drivers for Direct3D
Public Function EnumDeviceCallback(nGUID As Long, nDDDesc As Long, nDDName As Long, dHALDDDesc As D3DDEVICEDESC, dHELDDDesc As D3DDEVICEDESC, nOptions As Long) As Long
' Setup local variables ...
Dim L_nTemp(256) As Byte ' Temporary array for name and guid translation
Dim L_nChar As Byte ' Temporary charactar for name translation
Dim L_nIndex As Long ' Variable to run through temp array
Dim L_dD3DDriver As tD3DDriver
' Process current driver ...
' Inspect current driver
With L_dD3DDriver
' Set driver capabilities...
' Decide if hardware supports color model and enable HAL or HEL support properly
If dHALDDDesc.dcmColorModel Then
.DEVDESC = dHALDDDesc
.HDW = True
Else
.DEVDESC = dHELDDDesc
End If
' Set RGB capability
.RGB = (.DEVDESC.dcmColorModel = D3DCOLOR_RGB)
' Set emulation mode
.EMU = (Not .HDW)
' Set mono ramp mode
.MONO = (Not .RGB)
' Decide if driver fits application needs ...
' Exit without naming/enabling driver if no RGB support
' If Not .RGB Then
' EnumDeviceCallback = DDENUMRET_OK
' Exit Function
' End If
' Exit without naming/enabling driver if no support for minimum 8 bit color depth
' If ((.DEVDESC.dwDeviceRenderBitDepth And DDBD_8) = 0) And ((.DEVDESC.dwDeviceRenderBitDepth And DDBD_16) = 0) And ((.DEVDESC.dwDeviceRenderBitDepth And DDBD_24) = 0) And ((.DEVDESC.dwDeviceRenderBitDepth And DDBD_32) = 0) Then